package com.yunquan.ohana

import cn.jiguang.api.utils.JCollectionAuth
import cn.jpush.android.api.JPushInterface
import com.shuyu.gsyvideoplayer.cache.CacheFactory
import com.shuyu.gsyvideoplayer.player.IjkPlayerManager
import com.shuyu.gsyvideoplayer.player.PlayerFactory
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
import com.yunquan.ohana.base.BaseApplication
import com.yunquan.ohana.base.CrashHandler
import com.yunquan.ohana.db.DBManager
import io.microshow.rxffmpeg.RxFFmpegInvoke
import tv.danmaku.ijk.media.exo2.Exo2PlayerManager
import tv.danmaku.ijk.media.exo2.ExoPlayerCacheManager
import tv.danmaku.ijk.media.player.IjkMediaPlayer

class MyApplication : BaseApplication() {
    override fun onCreate() {
        super.onCreate()
        CrashHandler.instance.init()

        DBManager.instance

        JPushInterface.setDebugMode(false)
        JPushInterface.init(this)
        JCollectionAuth.setAuth(this, true)

        RxFFmpegInvoke.getInstance().setDebug(false)

        GSYVideoType.setRenderType(GSYVideoType.GLSURFACE)
        GSYVideoType.enableMediaCodec()
        GSYVideoType.enableMediaCodecTexture()
        GSYVideoType.setShowType(GSYVideoType.SCREEN_TYPE_DEFAULT)
        PlayerFactory.setPlayManager(Exo2PlayerManager::class.java)
        CacheFactory.setCacheManager(ExoPlayerCacheManager::class.java)
        IjkPlayerManager.setLogLevel(IjkMediaPlayer.IJK_LOG_ERROR)
    }
}